<%@ page language="java" import="java.util.*,com.beans.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    

<script type="text/javascript" src="js/jquery-1.8.0.js"></script> 
	<script type="text/javascript">
		$(function(){
			$("#ch_checkall,#top_ch_checkall").click(function(){
				if(this.checked){
					$("input[name=ck_id]").attr("checked","checked");
				}else{
					$("input[name=ck_id]").removeAttr("checked");
				}		
			});
					
			$("table tr").mouseover(function(){
				$(this).css("background","#D3EAEF");
				$(this).siblings().css("background","white");
			});
		});
	</script>
	
	<script >

		function delOk(e){
			var ok=true;
			$.ajax({
				type:"POST",
				url:"RoleServlet.do",
				data:{flog:"delOk",roleId:e},
				async:false,
				success:function(o){
					if(o!="0"){
						alert("该角色还有"+o+"人，不能删除！！！");
						ok=false;
					}else{
						ok=confirm("确认删除？？？");
					}
				}
			});
			return ok;
		}
	
	</script>

	<link rel="stylesheet" type="text/css" href="css/maintable.css" ></link>


</head>

<body>
	<body>
		<div class ="div_title">
		<div class="div_titlename"> <img src="images/san_jiao.gif" ><span>角色列表</span></div>
		<div class="div_titleoper"><input type="checkbox" /> 全选 <a href="#"> <img src="images/add.gif"/>添加 </a> <a href="#"><img src="images/del.gif"/>删除</a> <a href="#">  <img src="images/edit.gif"/>编辑 </a></div>
	 </div>
	
	<table class="main_table">
		<tr>
			<th>角色名称</th>
			<th>角色描述</th>
			<th>操作</th>
		</tr>
		<c:forEach var="r" items="${roleList }">
			<tr>
				<td>${r.roleName }</td>
				<td>${r.des }</td>
				<td> 
					<a id="${r.id }" href="RoleServlet.do?flog=delRole&roleId=${r.id }" onclick="return delOk('${r.id }')">删除</a>  
					<a href="perm/role_change.jsp?id=${r.id }">修改</a> 
					<a href="RoleServlet.do?flog=roleMenu&roleId=${r.id }">权限分配</a>
				</td>
			<tr>
		</c:forEach>
		
	</table>
	${msg }
</body>
</html>	
